package cn.akira.domain.strategy.service.rule.chain.impl;

import cn.akira.domain.strategy.service.armory.IStrategyDispatch;
import cn.akira.domain.strategy.service.rule.chain.AbstractLogicChain;
import cn.akira.domain.strategy.service.rule.chain.ILogicChain;
import cn.akira.domain.strategy.service.rule.chain.factory.DefaultChainFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @author fjl95
 * @date 2025/5/15
 * @description 默认链（最后一步）
 */
@Slf4j
@Component("default")
public class DefaultLogicChain extends AbstractLogicChain{



    @Resource
    private IStrategyDispatch strategyDispatch;
    @Override
    protected String ruleModel() {
        return "default";
    }

    @Override
    public DefaultChainFactory.StrategyAwardVO logic(String userId, Long strategyId) {
        Integer awardId = strategyDispatch.getRandomAwardId(strategyId);
        return DefaultChainFactory.StrategyAwardVO.builder()
                .awardId(awardId)
                .logicModel(ruleModel())
                .build();
    }
}
